From: Alastair Tse Date: Fri, 3 Nov 2006 15:47:05 +0000 (+0000) Subject: [XEND] Cleanup HVM image shutdown watch and move readDom call away X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22?a=commitdiff_plain;h=2791eeb6459647ea4cdbbe987b6b3a26f2e9ef1a;p=xen.git [XEND] Cleanup HVM image shutdown watch and move readDom call away from image.py Signed-off-by: Alastair Tse --- diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py index 8e6f462ea0..ec0f8e8c2f 100644 --- a/tools/python/xen/xend/XendDomainInfo.py +++ b/tools/python/xen/xend/XendDomainInfo.py @@ -797,12 +797,13 @@ class XendDomainInfo: def getDomainPath(self): return self.dompath + def getShutdownReason(self): + return self._readDom('control/shutdown') def getStorePort(self): """For use only by image.py and XendCheckpoint.py.""" return self.store_port - def getConsolePort(self): """For use only by image.py and XendCheckpoint.py""" return self.console_port diff --git a/tools/python/xen/xend/image.py b/tools/python/xen/xend/image.py index c264fb669e..c70c94fc00 100644 --- a/tools/python/xen/xend/image.py +++ b/tools/python/xen/xend/image.py @@ -24,7 +24,7 @@ import signal import xen.lowlevel.xc from xen.xend import sxp -from xen.xend.XendError import VmError +from xen.xend.XendError import VmError, XendError from xen.xend.XendLogging import log from xen.xend.server.netif import randomMAC from xen.xend.xenstore.xswatch import xswatch @@ -456,9 +456,13 @@ class HVMImageHandler(ImageHandler): """ from xen.xend.XendConstants import DOMAIN_SHUTDOWN_REASONS xd = xen.xend.XendDomain.instance() - vm = xd.domain_lookup( self.vm.getDomid() ) + try: + vm = xd.domain_lookup( self.vm.getDomid() ) + except XendError: + # domain isn't registered, no need to clean it up. + return - reason = vm._readDom('control/shutdown') + reason = vm.getShutdownReason() log.debug("hvm_shutdown fired, shutdown reason=%s", reason) for x in DOMAIN_SHUTDOWN_REASONS.keys(): if DOMAIN_SHUTDOWN_REASONS[x] == reason: